<?php
namespace app\wechat\controller;

class Service extends Common
{
    // 客服首页
    public function index()
    {
        $type = input('param.type', 0);
        $this->assign('type', $type);
        $param = [
            'read_type' => $type
        ];
        $data = call_interface('get_faq_list', $param);
        $this->assign('data', $data['data']);


        return view();
    }

    // 常见问题详情
    public function faq_info() {
        $id = input('param.id', 0);
        $param = [
            'id' => $id
        ];
        $data = call_interface('get_faq_info', $param);
        $this->assign('data', $data['data']);
        return view();
    }

    // 意见反馈
    public function feedback() {
        $type = input('param.type');
        if (request()->isAjax()) {
            $param = [
                'member_id' => session('member_id'),
                'content' => input('param.content', ''),
                'type' => $type,
            ];
            $data = call_interface('member_feedback', $param);
            return json($data);
        } else {
            $this->assign('type', $type);
            return view();
        }
    }
}
